<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>加法</title>
	</head>
	<body>
		<input id="num1" />  +   <input id="num2" />
		<input type="button" value="=" onclick="JiaFa()" />
		<input id="num3" />
		<script>
		var JiaFa = function(){
			if(isNaN(num1.value)==true || isNaN(num2.value)==true){
				alert("请您输入合法的数字!");
			}else{
				num3.value = parseFloat(num1.value) + parseFloat(num2.value);
			}
		};
		</script>
	</body>
</html>
